// 引入首页Api
import { findHeadCategory } from '@/api/home.js'
// 导航模块
const category = {
  namespaced: true,
  // 存数据
  state: () => ({
    list: []
  }),
  // 该数据
  mutations: {
    setList (state, categoryList) {
      state.list = categoryList
    }
  },
  // 异步
  actions: {
    async asyncSetList (ctx) {
      // 1.发送请求
      const { result } = await findHeadCategory()
      // 2.触发mutation
      ctx.commit('setList', result)
    }
  },
  // 计算属性
  getters: {}
}

export default category
